#include <linux/ioctl.h> /* needed for the _IOW etc stuff used later */
#include <asm/hardware.h>
#include <asm/io.h>
#include <linux/ioport.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <asm/arch-s3c2410/irqs.h>
#include <asm/arch-s3c2410/regs-gpio.h>


#define IO_IRQ1    IRQ_EINT19
#define IO_IRQ2    IRQ_EINT11
#define IO_IRQ3    IRQ_EINT2
#define IO_IRQ4    IRQ_EINT0


#define IO_IRQ1_MASK 	 0x1
#define IO_IRQ2_MASK 	 0x2
#define IO_IRQ3_MASK   	 0x4
#define IO_IRQ4_MASK  	 0x8
#define IO_IRQ_ALL_MASK   0x10

#define DELAY 10

struct IO_irq_dev {
	struct semaphore sem;     /* mutual exclusion semaphore     */
	struct cdev cdev;	  /* Char device structure		*/
	unsigned int IO_irq1;
	unsigned int IO_irq2;
	unsigned int IO_irq3;
	unsigned int IO_irq4;
	unsigned char IO_status;
};

struct IO_irq_key {
	unsigned long prevjiffies ;
	int count;	
};



/*
 * Split minors in two parts
 */
#define TYPE(minor)	(((minor) >> 4) & 0xf)	
/* high nibble */
#define NUM(minor)	((minor) & 0xf)		
/* low  nibble */


/*
 * The different configurable parameters
 */
extern int IO_irq_major;     /* main.c */
extern int IO_irq_minor;



int     IO_irq_ioctl(struct inode *inode, struct file *filp,
                 unsigned int cmd, unsigned long arg);


/*
 * Ioctl definitions
 */

/* Use 'k' as magic number */
#define IO_IRQ_MAGIC  'k'
/* Please use a different 8-bit number in your code */

#define IO_IRQ_1     	_IO(IO_IRQ_MAGIC, 0)
#define IO_IRQ_2  	_IO(IO_IRQ_MAGIC, 1)
#define IO_IRQ_3       	_IO(IO_IRQ_MAGIC, 2)
#define IO_IRQ_4 		_IO(IO_IRQ_MAGIC, 3)
#define IO_IRQ_ALL 	_IO(IO_IRQ_MAGIC, 4)
#define IO_KFIFO_SIZE 	_IO(IO_IRQ_MAGIC, 5)
#define IO_KFIFO_RESET 	_IO(IO_IRQ_MAGIC, 6)
#define IO_IRQ_MAXNR 6
